package server;

import java.io.IOException;

/**
 *
 */
public abstract class HttpServlet implements Servlet {

  public abstract void doGet(Request request, Response response) throws IOException;

  public abstract void doPost(Request request, Response response) throws IOException;

  @Override
  public void init() throws Exception {

  }

  @Override
  public void destroy() throws Exception {

  }

  @Override
  public void service(Request request, Response response) throws Exception {

    if ("GET".equals(request.getMethod())) {
      doGet(request, response);
    } else {
      doPost(request, response);
    }
  }
}
